{template 'header'}
<style type="text/css">
    .cz_top{
        background: #fff;
        padding: 2vw;
        box-shadow: 1px 2px 8px #d1d1d1;
    }
    .cz_top img{
        width: 14vw;
        border-radius: 50%;
        float: left;
        margin-right: 2vw;
    }
    .cz_top h4{
        color: #7a7a7a;
        font-weight: 500;
        font-size: 16px;
        margin-top: 3vw;
    }
    .cz_top p{
        font-size: 12px;
    }
    .cz_zhuanqu{
        padding: 2vw 2vw 8vw 2vw !important;
        background: #fff;
        margin-top: 2vh;
        box-shadow: 1px 2px 8px #d1d1d1;
    }
    .cz_zhuanqu div{
        box-sizing: border-box;
    }
    .cz_zhuanqu .title{
        text-align: center;
        line-height: 3;
        font-size: 16px;
        color: #00a0e9;
    }
    .cz_huiyuanleixing{
        width: 94vw;
        margin: 1vh auto 0 auto;
        box-shadow: 1px 1px 14px #e9e9e9;
    }
    .cz_zhuanqu_box{
        line-height: 5vh;
        padding: 2vw 4vw;
        font-size: 14px;
        color: #666;
        position: relative;
    }
    .cz_zhuanqu_box b ,.cz_zhuanqu_box i{
        font-weight: 500;
    }
    .cz_zhuanqu_box i{
        font-style: normal;
        font-size: 14px;
    }
    .cz_zhuanqu_box b{
        color: #f17f7f;
        font-size: 18px;
        float: right;
    }
    .cz_zhuanqu_box img{
        position: absolute;
        right: -1px;
        bottom: 0;
        width: 10vw;
        display: none;
    }
    .cz_huiyuanleixing .cur{
        border: .4vw solid #007aff
    }
    .cz_huiyuanleixing .cur img{
        display: block;
    }
    .cz_quanyi{
        background: #fff;
        margin-top: 2vh;
        padding: 2vw;
        box-shadow: 1px 1px 14px #cacaca;
        margin-bottom: 6vh;
    }
    .cz_quanyi p{
        margin-bottom: 0;
        text-indent: 2rem;
        font-size: 12px;
    }
    .cz_quanyi div{
        font-size: 14px;
    }
    .bottom_btn{
        position: fixed;
        bottom: 0;
        width: 100%;
    }
    .bottom_btn span{
        font-size: 14px;
        margin-bottom: 0;
        padding: 12px 0;
    }
</style>
</head>

<body>
<!--顶部-->
<div class="mui-content">
    <div class="cz_top mui-clearfix">
        <img src="{MODULE_URL}assets/img/logo.png"/>
        <h4>ID:<span>{$user_id}</span></h4>
        <p>您暂时还未开通会员</p>
    </div>
</div>
<!-- 会员专区 -->
<div class="mui-content cz_zhuanqu" style="padding: 0;">
    <div class="title">升级VIP</div>
    <div class="cz_huiyuanleixing">
        <div class="cz_zhuanqu_box cur">
            <span>会员</span>
            <b><i>￥</i>{$fenxiao_setting_v1['vip_upgrade_price']}</b>
            <img src="{MODULE_URL}assets/img/pick_jiao.png"/>
        </div>
    </div>
</div>
<!--会员权益-->
<div class="mui-content cz_quanyi">
    <div>会员权益</div>
    <p>支付{$upgrade_setting['vip_upgrade_price']}元成为会员，每天领取平台发布任务并按照任务要求提交即可赚取{$share_setting['task_money']}元佣金。</p>
    <p>
        每日完成发圈任务佣金固定{$share_setting['task_money']}元，每分享一个好友，奖励好友所交会费{$fenxiao_setting_v1['vip_upgrade_first_per']}%奖金并获取好友每天完成任务的{$fenxiao_setting_v1['vip_task_first_per']}%佣金。无限级叠加。</p>
    <!--<div style="margin-top: 20px;">代理权益</div>-->
    <!--<p>支付999元成为代理，每天领取平台发布高级任务并按照要求提交即可赚取40元佣金。</p>-->
    <!--<p>每日完成任务佣金固定40元，每分享一个好友，奖励好友所交会费10%奖金。并获取直推好友每天完成任务的8元佣金，二级好友完成任务的2元佣金，无限级叠加。</p>-->
</div>
<!--底部定位-->
<div class="mui-content bottom_btn">
    <div class="cz_dibu">
<!--        <p class="cz_dibu_title">你已经选择会员￥{$fenxiao_setting_v1['vip_upgrade_price']}</p>-->
        <span class="cz_dibu_btn mui-btn mui-btn-block mui-btn-primary" onclick="callpay()">购买</span>
    </div>
</div>
<script src="{MODULE_URL}assets/js/mui.min.js"></script>
<script type="text/javascript" src="{$_W['siteroot']}app/resource/js/lib/jquery-1.11.1.min.js?v=20160906"></script>
<script type="text/javascript">
    mui.init();
    mui.ready(function () {

    });

    var user_level = '{$user["user_level"]}';
    if (user_level > 0) {
        mui.alert('您已经是VIP啦！', '', function () {
            location.href = '{php echo $this->createMobileUrl("member",array("op"=>"index"))}'
        })
    }
    var fee = "{$fenxiao_setting_v1['vip_upgrade_price']}";
    //发起微信支付，微信支付依赖于 WeixinJSBridge 组件，所以发起时应该在ready事件中进行
    var url = '{php echo $this->createMobileUrl("core",array("op"=>"upgarde_weixinjspay_ordermake"))}' + "&fee=" + fee;
    //调用微信JS api 支付
    function jsApiCall(jsApiParameters) {
        WeixinJSBridge.invoke(
            'getBrandWCPayRequest',
            jsApiParameters,
            function (res) {
                WeixinJSBridge.log(res.err_msg);
                if (res.err_msg == 'get_brand_wcpay_request:ok') {
                    mui.alert('支付成功！','',function () {
                        location.href = '{php echo $this->createMobileUrl("member",array("op"=>"index"))}'
                    });
                } else {
                    mui.alert('支付失败：' + res.err_code + res.err_desc + res.err_msg);
                }
            }
        );
    }
    function callpay() {
        var openId = '{$openId}';
        var fee = '{$fenxiao_setting_v1["vip_upgrade_price"]}';
        var url = '{php echo $this->createMobileUrl("core",array("op"=>"upgarde_weixinjspay_ordermake"))}';
        mui.post(url,{openId,fee},function(ret){
            if(ret.code){
                mui.toast(ret.msg);
                window.setTimeout(function () {
                    if (typeof WeixinJSBridge == "undefined") {
                        if (document.addEventListener) {
                            document.addEventListener('WeixinJSBridgeReady', jsApiCall, false);
                        } else if (document.attachEvent) {
                            document.attachEvent('WeixinJSBridgeReady', jsApiCall);
                            document.attachEvent('onWeixinJSBridgeReady', jsApiCall);
                        }
                    } else {
                        jsApiCall(ret.data);
                    }
                },1500)
            }else{
                mui.toast(ret.msg)
            }
        },'json');
    }
    $('.cz_zhuanqu_box').click(function () {
        $('.cz_zhuanqu_box').removeClass('cur');
        $(this).addClass('cur')
    });
</script>
</body>

</html>